using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using GestaoEventos.Business;
using GestaoEventos.Interface;

public partial class MasterPage : System.Web.UI.MasterPage
{
	protected void Page_Load(object sender, EventArgs e)
	{
		if(Parent.Page.AppRelativeVirtualPath.ToString() == "~/Default.aspx")
		{
            Session["isLogged"] = null;
            Session.Clear();
			menulateral.Visible = false;
			bemVindo.Visible = false;
		}
		else
		{
            if (!Convert.ToBoolean(Session["isLogged"]))
            {
                Session.Clear();
                Response.Redirect("~/Default.aspx");
            }

            if (((I_Usuario)Session["IUsuarioLogado"]).Tipo == Framework.Enumerador.TipoUsuario.Administrador)
                XmlDataSource1.DataFile = "~/_Menu/MenuAdmin.xml";
            else
                XmlDataSource1.DataFile = "~/_Menu/MenuUsuario.xml";

			lblBemVindo.Text = ((I_Usuario)Session["IUsuarioLogado"]).Nome;
        }
	}
}
